package com.itheima.demo.demo13;

import java.util.stream.Stream;
//  two.add("古力娜扎");
//        two.add("张无忌");
//        two.add("赵丽颖");
//        two.add("张三丰");
//        two.add("尼古拉斯赵四");
//        two.add("张天爱");
//        two.add("张二狗");

public class StramZH {
    public static void main(String[] args) {
        Stream<String> stream1 = Stream.of("宋远桥", "苏星河", "石破天", "石中玉", "老子", "庄子", "洪七公");
        Stream<String> stream2 = stream1.filter((name) -> {
            if (name.length() == 3) {
                return true;
            } else {
                return false;
            }
        }).limit(3);
        Stream<String> stream = Stream.of("古力娜扎", "张无忌", "赵丽颖", "张三丰", "尼古拉斯赵四", "张天爱", "张二狗");
        Stream<String> stream3 = stream.filter((name) -> {
            if (name.startsWith("张")) {
                return true;
            } else {
                return false;
            }
        }).skip(2);
        Stream<String> concat = Stream.concat(stream2, stream3);
concat.map((name)->{
    Person per=new Person();
    per.setName(name);
    return per;
}).forEach(name-> System.out.println(name));


    }
}
